home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / Recent1 / DiskMaster21d.lha / DiskMasterII / rexx / Sub_FileRecog.REXX < prev   
OS/2 REXX Batch file  |  1997-01-07  |  3KB  |  140 lines

  1. /*
  2. ** $VER: FileRecog subroutine v2.8 (07.01.97) (c) Inorix scripts
  3. **
  4. ** FR_T clip : Filetype
  5. ** FR_S clip : Short type identifier
  6. ** FR_I clip : first 48 chars as hex string
  7. **
  8. ***************************************************************************
  9. ** Known filetypes:
  10. ** ----------------
  11. ** Archives: LZH,LHA,LHA-SFX,LZX,ZIP,ARC,RAR,ARJ,DMS,Zoom,XMash,XArchive,
  12. **           PackDev.
  13. ** Packed  : XPK,PP20.
  14. ** Images  : GIF,JPEG,IFF,ANIM.
  15. ** Sound   : WAVE,8SVX.
  16. ** Other   : EXE,ICON,GUIDE,IntroCAD.
  17. ** IFF     : ILBM,ANIM,8SVX,CTLG,PREF,CDAF,FAXX,STFax.
  18. \*************************************************************************/
  19.  
  20. OPTIONS RESULTS
  21.  
  22. PARSE ARG filename
  23.  
  24. CALL OPEN(file,filename,R)
  25. dump=READCH(file,48)
  26. CALL CLOSE(file)
  27. dump2=C2X(dump)
  28. SELECT
  29.   WHEN LEFT(dump2,8)='504B0304' THEN DO
  30.     ftype='Archive'
  31.     short='ZIP'
  32.   END
  33.   WHEN SUBSTR(dump2,5,10)='2D6C68352D' THEN DO
  34.     ftype='Archive'
  35.     short='LHA'
  36.   END
  37.   WHEN SUBSTR(dump2,5,10)='2D6C68312D' THEN DO
  38.     ftype='Archive'
  39.     short='LZH'
  40.   END
  41.   WHEN LEFT(dump2,4)='1A08' THEN DO
  42.     ftype='Archive'
  43.     short='ARC'
  44.   END
  45.   WHEN LEFT(dump2,4)='60EA' THEN DO
  46.     ftype='Archive'
  47.     short='ARJ'
  48.   END
  49.   WHEN LEFT(dump2,8)='4C5A5800' THEN DO
  50.     ftype='Archive'
  51.     short='LZX'
  52.   END
  53.   WHEN LEFT(dump2,8)='444D5321' THEN DO
  54.     ftype='DiskArchive'
  55.     short='DMS'
  56.   END
  57.   WHEN LEFT(dump2,8)='504B4413' THEN DO
  58.     ftype='DiskArchive'
  59.     packtype=SUBSTR(dump,25,4)
  60.     IF packtype=NULL() THEN packtype='NONE'
  61.     short='PKD-'packtype
  62.   END
  63.   WHEN LEFT(dump2,10)='4D53484400' THEN DO
  64.     ftype='DiskArchive'
  65.     short='XMS'
  66.   END
  67.   WHEN LEFT(dump2,8)='5A4F4D35' THEN DO
  68.     ftype='DiskArchive'
  69.     short='ZOOM'
  70.   END
  71.   WHEN LEFT(dump2,8)='52617221' THEN DO
  72.     ftype='Archive'
  73.     short='RAR'
  74.   END
  75.   WHEN LEFT(dump2,8)='58504B46' THEN DO
  76.     ftype='Packed data'
  77.     short='XPK-'SUBSTR(dump,9,4)
  78.   END
  79.   WHEN LEFT(dump2,8)='50503230' THEN DO
  80.     ftype='Packed data'
  81.     short='PP20'
  82.   END
  83.   WHEN LEFT(dump2,10)='000003F300' THEN DO
  84.     ftype='Executable'
  85.     short='EXE'
  86.     IF RIGHT(dump,4)='SFX!' THEN DO
  87.       ftype='Archive'
  88.       short='SFX'
  89.     END
  90.   END
  91.   WHEN LEFT(dump2,10)='E310000100' THEN DO
  92.     ftype='Icon'
  93.     short='ICON'
  94.   END
  95.   WHEN LEFT(dump2,12)='474946383761' THEN DO
  96.     ftype='Picture'
  97.     short='GIF'
  98.   END
  99.   WHEN LEFT(dump2,8)='FFD8FFE0' THEN DO
  100.     ftype='Picture'
  101.     short='JPG'
  102.   END
  103.   WHEN UPPER(LEFT(dump,9))='@DATABASE' THEN DO
  104.     ftype='AmigaGuide'
  105.     short='GUIDE'
  106.   END
  107.   WHEN LEFT(dump2,8)='464F524D' THEN DO
  108.     ftype='IFF'
  109.     short='IFF-'SUBSTR(dump,9,4)
  110.     IF RIGHT(short,4)='8SVX' THEN ftype='Sound'
  111.     IF RIGHT(short,4)='ILBM' THEN ftype='Picture'
  112.     IF RIGHT(short,4)='CTLG' THEN ftype='Catalog'
  113.     IF RIGHT(short,4)='PREF' THEN ftype='Preferences'
  114.     IF RIGHT(short,4)='ANIM' THEN ftype='Animation'
  115.     IF RIGHT(short,4)='FAXX' THEN ftype='Fax'
  116.     IF RIGHT(short,4)='STFX' THEN ftype='STFax'
  117.     IF RIGHT(short,4)='CDAF' THEN DO
  118.       ftype='Archive'
  119.       short='XAR'
  120.     END
  121.   END
  122.   WHEN (LEFT(dump2,8)='52494646')&(SUBSTR(dump2,17,8)='57415645') THEN DO
  123.     ftype='Sound'
  124.     short='WAVE'
  125.   END
  126.   WHEN LEFT(DUMP2,8)='0012D644' THEN DO
  127.     ftype='IntroCAD'
  128.     short='CAD'
  129.   END
  130.   OTHERWISE DO
  131.     ftype='Unsupported'
  132.     short='???'
  133.   END
  134. END
  135. SETCLIP(FR_T,ftype)
  136. SETCLIP(FR_S,short)
  137. SETCLIP(FR_I,dump2)
  138.  
  139. RETURN
  140.